﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReviewRequest.aspx.cs" Inherits="ReviewRequest" MasterPageFile="~/Site.master" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp"%>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
     <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    
    <br/>
     <asp:HyperLink ID="OperatorsLink" runat="server" NavigateUrl="~/Operator/OperatorPanel.aspx">Панель оперетора</asp:HyperLink>&nbsp;→&nbsp;
     <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Operator/Requests.aspx">Заявки</asp:HyperLink>&nbsp;→&nbsp;
     <b><asp:Label  ID="Label1" runat="server" Text="Рассмотрение заявки" ForeColor="black"></asp:Label></b>
    <br/>
    <br/>
    <table>
    <tr>
    <td><asp:Label ID="CreditLabel" runat="server" Text="Кредит:" AssociatedControlID="CreditList"></asp:Label></td>
    <td><asp:DropDownList Width="250px" ID="CreditList" runat="server" 
         DataSourceID="SqlDataSourceCredit" DataTextField="Name" 
         DataValueField="CreditID" ondatabound="CreditList_DataBound">
    </asp:DropDownList>
     <asp:SqlDataSource ID="SqlDataSourceCredit" runat="server" 
         ConnectionString="<%$ ConnectionStrings:BankDBConnectionString %>"
         SelectCommand="SELECT [Name], [CreditID] FROM [Credit] WHERE ([Active] = @Active)">
         <SelectParameters>
             <asp:Parameter DefaultValue="true" Name="Active" Type="Boolean" />
         </SelectParameters>
     </asp:SqlDataSource></td>
    </tr>

    <tr>
    <td><asp:Label ID="TermLabel" runat="server" Text="На срок:"></asp:Label></td>
    <td><asp:TextBox ID="TermLength" Width="244px" runat="server"></asp:TextBox>
    
    </td>
    </tr>

    <tr>
    <td> <asp:Label ID="AmountLabel" runat="server" Text="Сумма:"></asp:Label></td>
    <td>   <asp:TextBox ID="Amount" Width="244px" runat="server"></asp:TextBox><br />
    <asp:DropDownList ID="CurrencyList" runat="server" Width="250px"
         DataSourceID="SqlDataSourceCurrency" DataTextField="Name" 
         DataValueField="CurrencyID" ondatabound="CurrencyList_DataBound">
    </asp:DropDownList>
     <asp:SqlDataSource ID="SqlDataSourceCurrency" runat="server" 
         ConnectionString="<%$ ConnectionStrings:BankDBConnectionString %>" 
         SelectCommand="SELECT [CurrencyID], [Name] FROM [Currency]">
     </asp:SqlDataSource></td>
    </tr>

    <tr>
    <td> <asp:Label ID="FormLabel" runat="server" Text="Форма выдачи:"></asp:Label></td>
    <td> 
           <asp:DropDownList ID="CreditFacilitiesFormList" Width="250px" runat="server" 
               DataSourceID="SqlDataSourceForm" DataTextField="Name" 
               DataValueField="CreditFacilitiesFormId" Enabled="false">
           </asp:DropDownList>
           <asp:SqlDataSource ID="SqlDataSourceForm" runat="server" 
               ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" 
               
               SelectCommand="SELECT CreditFacilitiesForm.CreditFacilitiesFormId, CreditFacilitiesForm.Name FROM CreditFacilitiesForm INNER JOIN CreditCreditFacilitiesForm ON CreditFacilitiesForm.CreditFacilitiesFormId = CreditCreditFacilitiesForm.CreditFacilitiesFormId INNER JOIN Credit ON CreditCreditFacilitiesForm.CreditId = Credit.CreditID INNER JOIN CreditRequest ON CreditFacilitiesForm.CreditFacilitiesFormId = CreditRequest.CreditFacilitiesFormId AND Credit.CreditID = CreditRequest.CreditId WHERE (CreditRequest.CreditRequestId = @requestId)">
               <SelectParameters>
                   <asp:SessionParameter Name="requestId" SessionField="requestId" />
               </SelectParameters>
           </asp:SqlDataSource>
           </td>
    </tr>

    <tr>
    <td> <asp:Label ID="CompanyNameLabel" runat="server" Text="Название предприятия"></asp:Label></td>
    <td> <asp:TextBox ID="CompanyName" Width="244px" runat="server"></asp:TextBox>
                <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="CompanyName"
MinimumPrefixLength="1" CompletionInterval="10" CompletionSetCount="3"
UseContextKey="True" ServiceMethod="GetCompletionList" DelimiterCharacters="" Enabled="True" 
                    ServicePath=""></asp:AutoCompleteExtender>
      <asp:RequiredFieldValidator ID="CompanyNameValidator" runat="server" ControlToValidate="CompanyName"
                        CssClass="failureNotification" ErrorMessage="Введите адресс" ValidationGroup="OperatorReviewCreditValidationGroup">*</asp:RequiredFieldValidator>         
                    </td>
    </tr>

    <tr>
    <td><asp:Label ID="OrganizationFormLabel" runat="server" Text="Организационная форма"></asp:Label></td>
    <td><asp:DropDownList Width="250px" ID="OrganizationForm" runat="server" 
         DataSourceID="SqlDataSourceOrgatizationalForm" DataTextField="Name" 
         DataValueField="CompanyOrganizationalFormId" 
         ondatabound="OrganizationForm_DataBound">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSourceOrgatizationalForm" 
         runat="server" 
         ConnectionString="<%$ ConnectionStrings:BankDBConnectionString %>" 
         SelectCommand="SELECT [Name], [CompanyOrganizationalFormId] FROM [OrganizationalForm]">
     </asp:SqlDataSource></td>
    </tr>
     <tr>
            <td><asp:Label ID="CompanySizeLabel" runat="server" Text="Размер предприятия"></asp:Label></td>
            <td><asp:DropDownList Width="250px" ID="CompanySizeList" runat="server" 
                    DataSourceID="SqlDataSourceCompanySize" DataTextField="Name" 
                    DataValueField="CompanySizeId" Enabled="false">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSourceCompanySize" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" 
                    SelectCommand="SELECT [Name], [CompanySizeId] FROM [CompanySize]">
                </asp:SqlDataSource>
             </td>
            </tr>
             <tr>
            <td><asp:Label ID="ActivityLabel" runat="server" Text="Вид деятельности"></asp:Label></td>
            <td><asp:TextBox ID="Activity" Width="244px" runat="server" Enabled="false" AutoPostBack="true"></asp:TextBox></td>
            </tr>
            <tr>
            <td><asp:Label ID="CreationDateLabel" runat="server" Text="Дата создания"></asp:Label></td>
            <td><asp:TextBox ID="CreationDate" Width="244px" runat="server" Enabled="false" AutoPostBack="true"></asp:TextBox></td>
            </tr>
    <tr>
    
        <td><asp:Label ID="HeadNameLabel" runat="server" Text="Ф.И.О. руководителя"></asp:Label></td>
    <td> <asp:TextBox ID="HeadName" Width="244px" runat="server"></asp:TextBox>
     <asp:RequiredFieldValidator ID="HeadNamevalidator1" runat="server" ControlToValidate="HeadName"
                        CssClass="failureNotification" ErrorMessage="Введите ФИО" ValidationGroup="RequestCreditValidationGroup">*</asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator ID="HeadnameValidator2" ControlToValidate="HeadName"
                    Text="Неправильный формат записи ФИО" ForeColor="Red" Display="Dynamic" ValidationExpression="^[А-ЯЁ][а-яё]{1,}(([ ]|[-])([А-ЯЁ]|[а-яё]){1}[а-яё]{1,})*$"
                    runat="server" ValidationGroup="OperatorReviewCreditValidationGroup" />                      

    </td>
    </tr>
    
    <tr>
    <td><asp:Label ID="CompanyAddressLabel" runat="server" Text="Адрес предприятия"></asp:Label></td>
    <td><asp:TextBox ID="CompanyAddress" Width="244px" runat="server"></asp:TextBox></td>
    </tr>
    
    <tr>
    <td><asp:Label ID="CompanyPhoneLabel" runat="server" Text="Телефон предприятия"></asp:Label></td>
    <td><asp:TextBox ID="CompanyPhone" Width="244px" runat="server"></asp:TextBox></td>
    </tr>
    
    <tr>
    <td><asp:Label ID="CompanyEmailLabel" runat="server" Text="Email предприятия"></asp:Label></td>
    <td><asp:TextBox ID="CompanyEmail" Width="244px" runat="server"></asp:TextBox></td>
    </tr>
    
    <tr>
    <td><asp:Label ID="CompanyProfitLabel" runat="server" Text="Доход предприятия за последние 2 года"></asp:Label></td>
    <td><asp:TextBox ID="CompanyProfit" Width="244px" runat="server"></asp:TextBox></td>
    </tr>
       <tr>
    <td><asp:Label ID="UserCommentAboutDateLabel" runat="server" Text="Удобное для клиента время"></asp:Label></td>
    <td><asp:TextBox ID="UserCommentAboutDate" runat="server" TextMode="MultiLine" Height="73px" 
            Width="244px" Enabled="false"></asp:TextBox></td>
    </tr>
    <tr>
    <td><asp:Label ID="Label2" runat="server" Text="Время прихода в банк"></asp:Label></td>
    <td><asp:TextBox ID="MeetingDate" Width="244px" runat="server"></asp:TextBox></td>
    <td>
    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" ControlToValidate="MeetingDate" Text="Введите в формате DD/MM/YYYY" ForeColor="Red" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d" ValidationGroup="RegisterCompanyValidationGroup"/>
     </td>
    </tr>
            
    <tr>
    <td><asp:Label ID="HaveCreditLabel" runat="server" Text="Наличие кредитов"></asp:Label></td>
    <td><asp:CheckBox ID="HaveCredit" runat="server" /></td>
    </tr>
     <tr>
    <td><asp:Label ID="UserIsRegisteredLabel" runat="server" Text="Зарегестрирован" Enabled="false"></asp:Label></td>
    <td><asp:CheckBox ID="UserIsRegisterd" runat="server" /></td>
    </tr>
    <tr>
    <td><asp:Label ID="CommentLabel" runat="server" Text="Комментарии"></asp:Label></td>
    <td> <asp:TextBox ID="OperatorComment" runat="server" Height="73px" 
            TextMode="MultiLine" Width="244px"></asp:TextBox></td>
    </tr>    
    </table><br />
    <asp:Button ID="ApproveRequestButton" runat="server" Text="Принять" ValidationGroup="OperatorReviewCreditValidationGroup" onclick="ApproveRequestButton_Click" />
        
        <br />
<asp:Button ID="RejectRequestButton" runat="server" Text="Отказать" onclick="RejectRequestButton_Click" 
        />
        <asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label>

</asp:Content>
